/* Family Group! - a chat app at 3 AM: deep chat green, paper beige, tick blue, notification red */
:root { --night: #0B2B26; --moon: #F3FFF9; --itch: #FFD166; --sheet: #FF4D5E; --coil: #25D366; --bite: #FF4D5E; --chat: #ECE5DD; }

/* Screens: chat doodles instead of Bzzz Off's coil */
.screen { background:
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96'%3E%3Crect x='10' y='12' width='26' height='14' rx='6' fill='%2325D366' fill-opacity='.12'/%3E%3Crect x='54' y='52' width='30' height='14' rx='6' fill='%23F3FFF9' fill-opacity='.08'/%3E%3Ccircle cx='70' cy='20' r='5' fill='%23FFD166' fill-opacity='.14'/%3E%3C/svg%3E"),
  radial-gradient(circle at 50% 35%, #145247 0%, var(--night) 72%); }
.screen.dim { background: radial-gradient(circle at 50% 40%, rgba(20,82,71,.93) 0%, rgba(11,43,38,.97) 70%); }
.mascot svg { animation: buzz .12s linear infinite alternate; }
@keyframes buzz { from { transform: translateX(-2px) rotate(-2deg); } to { transform: translateX(2px) rotate(2deg); } }
.menu-grid a.ghost { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 10px; font-size: 18px; text-decoration: none; }
html, body { background: var(--night); }

/* ---------- HUD ---------- */
.hud-top { align-items: center; }
.hud-left { flex-direction: row; gap: 6px; }
#score { font-size: 17px; text-shadow: none; padding: 0; color: var(--moon); }
.meters { display: flex; gap: 10px; align-items: center; }
.battery { display: inline-flex; gap: 3px; padding: 2px 3px; border: 2px solid var(--moon); border-radius: 5px; position: relative; }
.battery::after { content: ""; position: absolute; right: -6px; top: 5px; width: 3px; height: 8px; background: var(--moon); border-radius: 0 2px 2px 0; }
.battery i { width: 9px; height: 14px; border-radius: 2px; background: rgba(243,255,249,.15); }
.battery i.on { background: var(--coil); }
.battery i.on.low { background: var(--bite); animation: blink .5s steps(2) infinite; }
@keyframes blink { 50% { opacity: .3; } }
#combo { font-family: var(--comic); font-size: 24px; letter-spacing: .04em; color: var(--itch); text-shadow: var(--outline); min-width: 1px; }

/* ---------- The phone ---------- */
#play { position: fixed; inset: 0; z-index: 3; display: flex; align-items: center; justify-content: center; padding: max(66px, calc(env(safe-area-inset-top) + 58px)) 10px 12px;
  background: radial-gradient(circle at 50% 50%, rgba(37,211,102,.14), transparent 60%), var(--night); }
#phone { position: relative; width: min(430px, 100%); height: min(760px, 100%); display: flex; flex-direction: column; overflow: hidden;
  background: var(--chat) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='70' height='70'%3E%3Cg fill='none' stroke='%23000' stroke-opacity='.05' stroke-width='2'%3E%3Ccircle cx='15' cy='15' r='6'/%3E%3Cpath d='M45 40 l10 10 M55 40 l-10 10'/%3E%3Crect x='12' y='48' width='12' height='9' rx='3'/%3E%3C/g%3E%3C/svg%3E");
  border: 6px solid #1d2b36; border-radius: 34px; box-shadow: 0 0 0 4px var(--night), 0 20px 60px rgba(0,0,0,.5); color: #111; }
#phone.shake { animation: shake .4s; }
@keyframes shake { 20% { transform: translateX(-10px) rotate(-1deg); } 40% { transform: translateX(9px) rotate(1deg); } 60% { transform: translateX(-6px); } 80% { transform: translateX(4px); } }
#phone.dead::after { content: "🪫"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 90px; background: #000; animation: fadeIn .5s; z-index: 5; }
@keyframes fadeIn { from { opacity: 0; } }
.chat-head { display: flex; gap: 10px; align-items: center; padding: 12px 14px; background: #075E54; color: #fff; }
.chat-head b { display: block; font-size: 17px; line-height: 1.2; }
.chat-head small { font-size: 12px; opacity: .85; font-weight: 600; }
.av { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; font-size: 19px; border: 2px solid rgba(0,0,0,.2); flex: none; }
.av.big { width: 42px; height: 42px; background: #FFD166; font-size: 22px; }

#stack { position: relative; flex: 1; display: flex; align-items: center; justify-content: center; padding: 16px; touch-action: none; cursor: grab; z-index: 1; }
.msg { position: relative; width: 100%; max-width: 340px; background: #fff; border-radius: 4px 18px 18px 18px; padding: 12px 14px 18px; overflow: hidden;
  box-shadow: 0 2px 0 rgba(0,0,0,.12), 0 12px 30px rgba(0,0,0,.18); transition: transform .3s cubic-bezier(.3,1.3,.5,1), opacity .3s; user-select: none; }
.msg.dragging { transition: none; }
.msg.in { animation: msgIn .28s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes msgIn { from { transform: translateY(40px) scale(.85); opacity: 0; } }
.msg.charger { background: #DCF8C6; }
.msg .who { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.msg .who b { font-size: 15px; }
.msg .fwd { font-size: 13px; font-style: italic; color: #667; margin: 0 0 4px; font-weight: 600; }
.msg .txt { font-size: clamp(18px, 4.6vw, 21px); line-height: 1.35; font-weight: 700; color: #111; max-width: none; }
.msg .meta { text-align: right; font-size: 12px; color: #53bdeb; font-weight: 700; margin-top: 6px; max-width: none; }
.msg .timer { position: absolute; left: 0; bottom: 0; height: 6px; width: 100%; background: var(--coil); transform-origin: left; }
.msg .timer.low { background: var(--bite); }
.msg .stamp { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 10px;
  font-family: var(--comic); font-size: 30px; letter-spacing: .04em; opacity: 0; transform: rotate(-8deg) scale(1.4); }
.msg.good .stamp { color: #128C7E; opacity: 1; transform: rotate(-8deg); transition: all .15s; background: rgba(255,255,255,.85); }
.msg.bad .stamp { color: var(--bite); opacity: 1; transform: rotate(-8deg); transition: all .15s; background: rgba(255,255,255,.85); }
.msg.outL { transform: translateX(-140%) rotate(-20deg) !important; opacity: 0; transition-delay: .18s; }
.msg.outR { transform: translateX(140%) rotate(20deg) !important; opacity: 0; transition-delay: .18s; }
.msg.outD { transform: translateY(60%) scale(.8) !important; opacity: 0; transition-delay: .35s; }
.lbl { position: absolute; top: 50%; font-family: var(--comic); font-size: 24px; letter-spacing: .04em; opacity: 0; pointer-events: none; z-index: 0; }
#lblDel { left: 12px; color: var(--bite); }
#lblReply { right: 12px; color: #128C7E; }
.actions { display: flex; justify-content: space-around; gap: 12px; padding: 10px 16px 16px; }
.actions button { flex: 1; max-width: 160px; display: flex; flex-direction: column; align-items: center; font-size: 30px; line-height: 1.1; padding: 8px; cursor: pointer;
  border: 3px solid #1d2b36; border-radius: 18px; background: #fff; box-shadow: 0 5px 0 #1d2b36; font-family: var(--body); }
.actions button small { font-size: 14px; font-weight: 900; color: #1d2b36; }
.actions button:active { transform: translateY(4px); box-shadow: 0 1px 0 #1d2b36; }
#delBtn { background: #FFE3E6; }
#replyBtn { background: #DCF8C6; }
#toast { position: absolute; left: 12px; right: 12px; bottom: 96px; z-index: 3; background: #1d2b36; color: #fff; border-radius: 14px; padding: 10px 14px;
  font-weight: 800; font-size: 15px; text-align: center; animation: msgIn .25s; }
#flash { position: absolute; left: 0; right: 0; top: 30%; text-align: center; font-family: var(--comic); font-size: 32px; color: var(--itch);
  text-shadow: var(--outline); pointer-events: none; opacity: 0; z-index: 4; }
#flash.pop { animation: flashPop 1.2s ease-out; }
@keyframes flashPop { 0% { opacity: 0; transform: scale(.6); } 15% { opacity: 1; transform: scale(1.1); } 70% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: translateY(-30px); } }
#hint { position: fixed; left: 50%; bottom: 8px; transform: translateX(-50%); width: max-content; max-width: 92vw; background: rgba(11,43,38,.94); color: var(--moon);
  border: 3px dashed var(--moon); border-radius: 16px; padding: 8px 14px; font-weight: 800; font-size: 14px; text-align: center; pointer-events: none; z-index: 6; }

@media (prefers-reduced-motion: reduce) {
  .mascot svg { animation: none; }
  .msg.in, #phone.shake { animation: none; }
}
