:root {
  --sky: #8ADCF3; --sky2: #98CFF1; --action: #92DF43; --action-dark: #4F9F39;
  --warm: #F5B83A; --cool: #58D3BF; --ink: #503D32; --cream: #FFF7DC;
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", Arial, sans-serif;
  color: var(--ink); background: #2a4650; touch-action: none; user-select: none; -webkit-user-select: none;
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: #2a4650; }
button { font: inherit; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
#app { position: relative; width: 100%; height: 100%; max-width: 620px; margin: 0 auto; overflow: hidden; background: var(--sky); isolation: isolate; }
.screen { position: absolute; inset: 0; visibility: hidden; opacity: 0; pointer-events: none; transition: opacity .22s ease; }
.screen.active { visibility: visible; opacity: 1; pointer-events: auto; }
#home-screen, #game-field { background-position: center; background-size: cover; }
.home-tint { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(138,220,243,.12), rgba(255,247,220,.12) 55%, rgba(80,61,50,.10)); }
.home-card { position: absolute; top: max(5.8%, calc(env(safe-area-inset-top) + 20px)); left: 6%; right: 6%; bottom: max(5.3%, calc(env(safe-area-inset-bottom) + 17px)); display: flex; flex-direction: column; align-items: center; padding: 5% 6% 3.5%; border: 5px solid white; border-radius: 34px; background: linear-gradient(180deg, rgba(255,247,220,.95), rgba(255,236,224,.91)); box-shadow: 0 13px 0 rgba(80,61,50,.30), inset 0 0 0 3px rgba(245,184,58,.18); }
.eyebrow { display: inline-block; padding: 7px 18px; color: white; border: 3px solid white; border-radius: 999px; background: var(--cool); box-shadow: 0 4px 0 #389587; font-size: clamp(10px,2.6vw,14px); font-weight: 1000; letter-spacing: .17em; }
h1 { margin: 13px 0 3px; text-align: center; line-height: .83; letter-spacing: -.055em; filter: drop-shadow(0 5px 0 white); }
h1 span, h1 strong { display: block; }
h1 span { color: var(--ink); font-size: clamp(37px,10.7vw,66px); }
h1 strong { color: #f07a82; -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; font-size: clamp(47px,13.5vw,82px); }
.home-card > p { max-width: 360px; margin: 10px 0 2px; text-align: center; font-size: clamp(14px,3.6vw,19px); font-weight: 800; }
.hero-fruit { position: relative; flex: 1 1 auto; width: 100%; min-height: 205px; display: grid; place-items: center; pointer-events: none; }
.hero-fruit::before { content: ""; position: absolute; width: min(58vw,285px); aspect-ratio: 1; border: 10px solid white; border-radius: 50%; background: radial-gradient(circle at 36% 29%, white 0 9%, #c8f4ff 10% 58%, var(--sky2) 59%); box-shadow: 0 9px 0 rgba(80,61,50,.21); }
.hero-fruit img { position: absolute; z-index: 2; filter: drop-shadow(0 8px 4px rgba(80,61,50,.24)); }
#hero-main { width: min(49vw,245px); animation: hero-bob 2.5s ease-in-out infinite; }
#hero-left { width: min(22vw,108px); left: 2%; bottom: 4%; transform: rotate(-8deg); }
#hero-right { width: min(20vw,100px); right: 3%; bottom: 5%; transform: rotate(9deg); }
@keyframes hero-bob { 0%,100% { transform: translateY(5px) rotate(-2deg); } 50% { transform: translateY(-9px) rotate(2deg); } }
.spark { position: absolute; z-index: 3; color: var(--warm); font-style: normal; font-size: clamp(22px,6.8vw,37px); -webkit-text-stroke: 2px white; animation: twinkle 1.4s ease-in-out infinite alternate; }
.spark.one { left: 13%; top: 10%; }.spark.two { right: 10%; top: 13%; animation-delay: -.45s; }.spark.three { right: 7%; bottom: 27%; animation-delay: -.85s; }
@keyframes twinkle { to { transform: rotate(18deg) scale(1.25); } }
.merge-strip { height: 48px; display: flex; align-items: center; gap: 7px; margin: -1px 0 7px; padding: 4px 14px; border: 3px solid white; border-radius: 17px; background: rgba(138,220,243,.56); box-shadow: 0 4px 0 rgba(80,61,50,.16); }
.merge-strip span { width: 37px; height: 37px; display: grid; place-items: center; border-radius: 50%; background: white; }
.merge-strip span.big { width: 42px; height: 42px; }
.merge-strip img { max-width: 100%; max-height: 100%; object-fit: contain; }
.merge-strip b { font-size: 21px; }
.primary-button { width: min(90%,390px); min-height: 57px; padding: 12px 20px; border: 4px solid white; border-radius: 22px; color: var(--ink); background: linear-gradient(#b6f26a,var(--action)); box-shadow: 0 8px 0 var(--action-dark),0 12px 18px rgba(80,61,50,.20); font-size: clamp(18px,5vw,27px); font-weight: 1000; }
.primary-button:active { transform: translateY(5px); box-shadow: 0 3px 0 var(--action-dark); }
.text-button { border: 0; padding: 13px 18px 6px; color: var(--ink); background: transparent; font-size: clamp(13px,3.3vw,17px); font-weight: 900; text-decoration: underline; text-underline-offset: 4px; }
.best-line { margin-top: auto; color: #79675c; font-size: clamp(11px,2.8vw,14px); font-weight: 900; letter-spacing: .1em; }
.best-line b { color: #e85f70; }
.sound-button { display: grid; place-items: center; border: 4px solid white; color: white; background: var(--ink); box-shadow: 0 6px 0 rgba(80,61,50,.38); }
.sound-button span { position: relative; font-size: 27px; line-height: 1; }
.sound-button.sound-off span { opacity: .38; }
.sound-button.sound-off span::after { content: "×"; position: absolute; left: 2px; top: -5px; color: #ff6c82; font-size: 30px; opacity: 1; }
.home-sound { position: absolute; z-index: 8; top: max(5.4%,calc(env(safe-area-inset-top) + 14px)); right: 4.5%; width: 55px; height: 55px; border-radius: 18px; }

#game-field { position: absolute; inset: 0; overflow: hidden; }
#game-field::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg,rgba(255,255,255,.12),rgba(255,247,220,.04) 55%,rgba(80,61,50,.08)); pointer-events: none; }
.hud { position: absolute; z-index: 30; top: max(5.1%,calc(env(safe-area-inset-top) + 9px)); left: 3%; right: 3%; height: 58px; display: grid; grid-template-columns: 56px 1.25fr 1fr 56px; gap: 7px; }
.round-button { width: 56px; height: 56px; border-radius: 19px; font-size: 27px; }
.hud-pill { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; border: 4px solid white; border-radius: 19px; background: rgba(255,247,220,.95); box-shadow: 0 6px 0 rgba(80,61,50,.24); }
.hud-pill small { color: #806c5e; font-size: clamp(9px,2.2vw,12px); font-weight: 900; letter-spacing: .14em; }
.hud-pill strong { color: #e85f70; font-size: clamp(20px,5.2vw,28px); line-height: 1; }
.coin-pill strong { color: var(--ink); }.coin-pill strong span { color: var(--warm); }
.goal-strip { position: absolute; z-index: 25; top: max(13.4%,calc(env(safe-area-inset-top) + 77px)); left: 5%; right: 5%; height: 52px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; padding: 5px 10px; border: 3px solid white; border-radius: 18px; color: white; background: rgba(80,61,50,.91); box-shadow: 0 5px 0 rgba(80,61,50,.27); }
.goal-strip > span,.goal-strip > b { font-size: clamp(8px,2.1vw,11px); font-weight: 1000; letter-spacing: .08em; white-space: nowrap; }
.goal-strip > b { color: var(--warm); }
#evolution-row { display: flex; justify-content: center; align-items: center; min-width: 0; }
#evolution-row i { width: clamp(20px,5.7vw,31px); aspect-ratio: 1; display: grid; place-items: center; margin-left: -3px; border: 2px solid white; border-radius: 50%; background: var(--cream); overflow: hidden; }
#evolution-row img { width: 100%; height: 100%; object-fit: contain; }

#play-area { position: absolute; z-index: 5; top: 21.5%; left: 4%; right: 4%; bottom: max(6.2%,calc(env(safe-area-inset-bottom) + 12px)); overflow: hidden; border: 5px solid white; border-radius: 30px; background: linear-gradient(180deg,rgba(202,245,255,.80),rgba(255,247,220,.91) 70%); box-shadow: 0 9px 0 rgba(80,61,50,.24),inset 0 0 0 4px rgba(88,211,191,.17); }
#play-area::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 9%; background: linear-gradient(#f6c876,#e7a653); box-shadow: inset 0 5px 0 rgba(255,255,255,.45); pointer-events: none; }
#game-canvas { position: absolute; z-index: 3; inset: 0; width: 100%; height: 100%; touch-action: none; }
#next-preview { position: absolute; z-index: 12; top: 13px; right: 13px; width: 64px; display: grid; place-items: center; color: var(--ink); pointer-events: none; }
#next-preview small { margin-bottom: 2px; padding: 3px 8px; border-radius: 999px; color: white; background: var(--cool); font-size: 9px; font-weight: 1000; letter-spacing: .1em; }
#next-preview span { width: 58px; height: 58px; display: grid; place-items: center; border: 4px solid white; border-radius: 50%; background: var(--cream); box-shadow: 0 5px 0 rgba(80,61,50,.25); }
#next-preview img { width: 90%; height: 90%; object-fit: contain; }
#warning-line { position: absolute; z-index: 7; top: 19%; left: 3%; right: 3%; border-top: 4px dashed rgba(232,95,112,.85); pointer-events: none; }
#danger-label { position: absolute; z-index: 8; top: calc(19% - 9px); left: 9px; padding: 3px 8px; border-radius: 999px; color: white; background: #e85f70; font-size: 9px; font-weight: 1000; letter-spacing: .08em; pointer-events: none; }
#danger-meter { position: absolute; z-index: 9; top: calc(19% + 5px); left: 10px; width: 76px; height: 7px; border: 2px solid white; border-radius: 999px; background: rgba(80,61,50,.22); overflow: hidden; opacity: 0; transition: opacity .2s; }
#danger-meter.show { opacity: 1; }
#danger-meter i { display: block; width: 0; height: 100%; background: #e85f70; }
#drop-hint { position: absolute; z-index: 10; left: 50%; bottom: 2.3%; transform: translateX(-50%); color: rgba(80,61,50,.72); font-size: clamp(9px,2.4vw,12px); font-weight: 1000; letter-spacing: .14em; white-space: nowrap; pointer-events: none; }

.overlay { position: absolute; z-index: 100; inset: 0; display: grid; place-items: center; padding: max(7%,env(safe-area-inset-top)) 6% max(7%,env(safe-area-inset-bottom)); background: rgba(51,61,62,.52); backdrop-filter: blur(5px); transition: opacity .2s ease; }
.overlay.hidden { visibility: hidden; opacity: 0; pointer-events: none; }
.modal { position: relative; width: min(100%,470px); padding: 45px 7% 27px; border: 5px solid white; border-radius: 31px; background: linear-gradient(180deg,#fffbe8,#ffecef); box-shadow: 0 13px 0 rgba(80,61,50,.42),inset 0 0 0 3px rgba(245,184,58,.17); text-align: center; }
.modal-medal { position: absolute; top: -41px; left: 50%; width: 82px; height: 82px; display: grid; place-items: center; transform: translateX(-50%); border: 6px solid white; border-radius: 50%; color: white; background: var(--warm); box-shadow: 0 8px 0 #a77224; font-size: 39px; font-weight: 1000; }
.modal h2 { margin: 14px 0 7px; color: var(--ink); font-size: clamp(25px,6.8vw,39px); line-height: .96; }
.modal > p { margin: 7px 0 15px; color: #79675c; font-weight: 800; }
.tutorial-demo { position: relative; height: 128px; margin: 8px 0 14px; border: 3px solid rgba(80,61,50,.18); border-radius: 20px; background: linear-gradient(180deg,#dff6fb,#c5eff2); overflow: hidden; }
.tutorial-demo img { position: absolute; width: 66px; height: 66px; object-fit: contain; filter: drop-shadow(0 4px 2px rgba(80,61,50,.22)); }
#demo-fruit-a { left: 12%; bottom: 12px; }#demo-fruit-b { left: 34%; bottom: 12px; }#demo-fruit-c { right: 9%; bottom: 12px; width: 80px; height: 80px; animation: demo-pop 1.4s ease-in-out infinite; }
.tutorial-demo i { position: absolute; left: 30%; bottom: 29px; font-size: 24px; font-style: normal; font-weight: 1000; }.tutorial-demo b { position: absolute; left: 59%; bottom: 28px; font-size: 29px; }
.finger { position: absolute; z-index: 4; left: 15%; top: 2px; font-size: 31px; animation: demo-drag 2s ease-in-out infinite; }
@keyframes demo-drag { 50%,75% { transform: translateX(75px); } }@keyframes demo-pop { 50% { transform: scale(1.12) rotate(4deg); } }
.tutorial-modal ol { margin: 0 0 20px; padding-left: 25px; text-align: left; color: #625247; font-size: clamp(13px,3.4vw,17px); font-weight: 700; line-height: 1.5; }.tutorial-modal li::marker { color: #e85f70; font-weight: 1000; }
.modal .primary-button { width: 100%; }
.result-fruit { height: 120px; display: grid; place-items: center; }.result-fruit img { max-width: 120px; max-height: 120px; filter: drop-shadow(0 7px 3px rgba(80,61,50,.25)); animation: hero-bob 2.2s ease-in-out infinite; }
.result-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin: 10px 0 22px; }.result-stats div { padding: 11px 4px; border: 3px solid #efd9c9; border-radius: 15px; background: white; }.result-stats small { display: block; color: #806c5e; font-size: 9px; font-weight: 900; letter-spacing: .1em; }.result-stats strong { color: #e85f70; font-size: clamp(20px,5.7vw,30px); }
#landscape-warning { display: none; position: fixed; z-index: 999; inset: 0; align-items: center; justify-content: center; flex-direction: column; gap: 10px; padding: 30px; color: var(--cream); background: var(--ink); text-align: center; }#landscape-warning div { color: var(--warm); font-size: 67px; }#landscape-warning b { font-size: 27px; }#landscape-warning span { opacity: .75; }
@media (orientation: landscape) and (max-height:620px) { #landscape-warning { display: flex; } }
@media (max-height:700px) and (orientation:portrait) {
  .home-card { top: max(5%,calc(env(safe-area-inset-top) + 13px)); bottom: max(4.7%,calc(env(safe-area-inset-bottom) + 10px)); padding-top: 3.4%; }
  h1 { margin-top: 8px; }.home-card > p { margin-top: 6px; }.hero-fruit { min-height: 145px; }.merge-strip { height: 42px; margin-bottom: 5px; }.merge-strip span { width: 32px; height: 32px; }.merge-strip span.big { width: 36px; height: 36px; }.primary-button { min-height: 50px; }.text-button { padding-top: 9px; }
  .hud { top: max(4.9%,calc(env(safe-area-inset-top) + 7px)); height: 51px; grid-template-columns: 50px 1.2fr 1fr 50px; gap: 5px; }.round-button { width: 50px; height: 50px; }.goal-strip { top: max(13%,calc(env(safe-area-inset-top) + 64px)); height: 47px; }#play-area { top: 21%; bottom: max(5.5%,calc(env(safe-area-inset-bottom) + 8px)); }
  .tutorial-demo { height: 103px; }.tutorial-demo img { width: 55px; height: 55px; }#demo-fruit-c { width: 65px; height: 65px; }.tutorial-modal ol { line-height: 1.34; margin-bottom: 13px; }.result-fruit { height: 90px; }.result-fruit img { max-width: 90px; max-height: 90px; }
}
