:root {
  --ol: #5A3620;
  --cream: #FFF6E9;
  --cream2: #F6E6CF;
  --ink: #5A3620;
  --muted: #9A7658;
  --hunger: #F39C4A;
  --thirst: #4DB6E8;
  --sleep: #9B8CE0;
  --play: #7BC96F;
  --warn: #E8554E;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  background: #EBCB9E;
  background-image: radial-gradient(#E3BF8E 2px, transparent 2.5px);
  background-size: 22px 22px;
  font-family: 'Fredoka', 'Nunito', 'Trebuchet MS', system-ui, sans-serif;
  color: var(--ink);
  touch-action: manipulation;
  user-select: none; -webkit-user-select: none;
}
button { font-family: inherit; color: inherit; }
svg { display: block; }

#stage { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }
#game {
  position: absolute; left: 0; top: 0;
  width: 360px; height: 640px;
  transform-origin: 0 0;
  overflow: hidden;
  background: #A8D68B;
  box-shadow: 0 0 0 3px var(--ol), 0 18px 50px rgba(90, 54, 32, .35);
}
@media (max-width: 500px) { #game { box-shadow: none; } }

#scene { position: absolute; left: 0; top: 0; width: 360px; height: 100%; }
#nightShade { opacity: 0; transition: opacity 1.6s ease; }
#skyNight { opacity: 0; transition: opacity 1.6s ease; }
/* real-clock sky: .tod-dusk (5-7h, 17-19h) and .tod-night (19-5h); sleeping (.night) stays darker */
#skyDusk, #duskShade, #fireflies { opacity: 0; transition: opacity 1.6s ease; }
.tod-dusk #skyDusk { opacity: 1; }
.tod-dusk #duskShade { opacity: .12; }
.tod-night #skyNight { opacity: 1; }
.tod-night #nightShade { opacity: .2; }
.tod-night #bees { opacity: 0; }
.tod-night #fireflies, .night #fireflies { opacity: 1; }
.ff { animation: ffDrift 7s ease-in-out infinite; animation-play-state: paused; transform-box: fill-box; transform-origin: center; }
.tod-night .ff, .night .ff { animation-play-state: running; }
@keyframes ffDrift {
  0%, 100% { transform: translate(0, 0); opacity: .2; }
  25% { transform: translate(9px, -12px); opacity: 1; }
  50% { transform: translate(-6px, -20px); opacity: .5; }
  75% { transform: translate(-12px, -6px); opacity: 1; }
}
.night #nightShade { opacity: .36; }
.night #skyNight { opacity: 1; }
.bee { animation: beeBuzz 3.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes beeBuzz {
  0%, 100% { transform: translate(0, 0) rotate(-6deg); }
  25% { transform: translate(10px, -7px) rotate(4deg); }
  50% { transform: translate(18px, 2px) rotate(-3deg); }
  75% { transform: translate(7px, 8px) rotate(6deg); }
}
#bees { transition: opacity 1.6s ease; }
.night #bees { opacity: 0; }
@media (prefers-reduced-motion: reduce) { .bee { animation: none; } }

/* ---------- tactile buttons ---------- */
.tactile { cursor: pointer; transition: transform .12s ease, box-shadow .12s ease, filter .12s; }
.tactile.pressed, .tactile:active { transform: translateY(3px) scale(.95); }
.tactile:disabled, .tactile.disabled { cursor: default; filter: saturate(.35) brightness(.98); opacity: .6; }
.tactile:disabled.pressed, .tactile.disabled.pressed, .tactile:disabled:active { transform: none; }
.tactile:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

.icon-btn {
  width: 44px; height: 44px; border-radius: 14px; padding: 6px;
  border: 3px solid var(--ol); background: var(--cream);
  box-shadow: 0 4px 0 var(--ol);
}
.icon-btn.pressed, .icon-btn:active { box-shadow: 0 1px 0 var(--ol); }
.icon-btn svg { width: 100%; height: 100%; }

/* ---------- HUD ---------- */
#hud { position: absolute; left: 10px; right: 10px; top: 10px; pointer-events: none; }
#hud .toprow { position: relative; height: 46px; display: flex; justify-content: center; align-items: center; }
.nameplate {
  min-width: 150px; max-width: 176px; height: 44px; padding: 0 22px;
  display: flex; align-items: center; justify-content: center;
  background: var(--cream); border: 3px solid var(--ol); border-radius: 22px;
  box-shadow: 0 4px 0 var(--ol);
  font-weight: 700; font-size: 23px; letter-spacing: .5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#btnSettings { position: absolute; right: 0; top: 0; pointer-events: auto; }
.stats {
  margin-top: 10px; padding: 9px 10px 10px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px;
  background: rgba(255, 246, 233, .95); border: 3px solid var(--ol); border-radius: 18px;
  box-shadow: 0 4px 0 var(--ol);
}
.stat { position: relative; display: flex; align-items: center; gap: 7px; }
.sicon { width: 30px; height: 30px; flex: none; }
.sicon svg { width: 100%; height: 100%; }
.sbody { flex: 1; min-width: 0; }
.srow { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; line-height: 1; margin-bottom: 4px; }
.slabel { font-weight: 600; }
.spct { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--muted); }
.meter { position: relative; height: 13px; border: 2.5px solid var(--ol); border-radius: 8px; background: #EFDCC2; overflow: hidden; }
.fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 50%;
  border-radius: 0 5px 5px 0;
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, .38);
  transition: width .7s cubic-bezier(.3, 1.3, .5, 1), filter .3s;
}
.meter::after { /* segment ticks */
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 calc(20% - 2px), rgba(90, 54, 32, .16) calc(20% - 2px) 20%);
}
.stat[data-k=hunger] .fill { background: var(--hunger); }
.stat[data-k=thirst] .fill { background: var(--thirst); }
.stat[data-k=sleep] .fill { background: var(--sleep); }
.stat[data-k=play] .fill { background: var(--play); }
.stat.low .sicon { animation: wobble 1.4s ease-in-out infinite; }
.stat.crit .sicon { animation: wobble .7s ease-in-out infinite; }
.stat.crit .spct { color: var(--warn); }
.stat.gain .fill { filter: brightness(1.18); }
@keyframes wobble { 0%, 100% { transform: rotate(0) scale(1); } 25% { transform: rotate(-12deg) scale(1.08); } 75% { transform: rotate(12deg) scale(1.08); } }

.gainText {
  position: absolute; right: 2px; top: -12px; font-weight: 700; font-size: 15px; color: #fff; pointer-events: none;
  -webkit-text-stroke: 4px var(--ol); paint-order: stroke fill;
  animation: rise 1s ease-out forwards;
}
@keyframes rise { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-26px); opacity: 0; } }

/* ---------- bottom panel ---------- */
#panel {
  position: absolute; left: 0; right: 0; bottom: 0; height: 132px;
  padding: 10px 10px 0;
  background: var(--cream); border-top: 3px solid var(--ol);
  border-radius: 22px 22px 0 0;
}
#actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; height: 68px; }
.act {
  position: relative; border: 3px solid var(--ol); border-radius: 18px; padding: 4px 0 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  box-shadow: 0 4px 0 var(--ol);
  font-weight: 700; font-size: 13.5px; letter-spacing: .6px;
}
.act.pressed, .act:active { box-shadow: 0 1px 0 var(--ol); }
.act .aicon { width: 36px; height: 36px; }
.act .aicon svg { width: 100%; height: 100%; }
.act[data-act=feed] { background: #FFD9B0; }
.act[data-act=drink] { background: #CDEBFA; }
.act[data-act=sleep] { background: #E0D9FA; }
.act[data-act=play] { background: #D5F0CB; }
.badge {
  position: absolute; top: -9px; right: -7px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--warn); color: #fff; border: 2.5px solid var(--ol); font-size: 13px; line-height: 17px;
  display: none; animation: bob 1s ease-in-out infinite;
}
.act.need .badge { display: block; }
.act:disabled .badge { display: none; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }

.wake {
  display: none; width: 100%; height: 68px; border: 3px solid var(--ol); border-radius: 20px;
  background: #FFE79A; box-shadow: 0 4px 0 var(--ol);
  font-weight: 700; font-size: 24px; letter-spacing: 1px;
  align-items: center; justify-content: center; gap: 10px;
}
.wake .aicon { width: 40px; height: 40px; }
.wake .aicon svg { width: 100%; height: 100%; }
.wake.pressed, .wake:active { box-shadow: 0 1px 0 var(--ol); }
.sleeping #actions { display: none; }
.sleeping .wake { display: flex; animation: glow 2s ease-in-out infinite; }
@keyframes glow { 50% { background: #FFF0BD; } }

.pill {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin: 10px auto 0; width: 160px; height: 38px;
  border: 3px solid var(--ol); border-radius: 19px; background: #FCE3E8; box-shadow: 0 4px 0 var(--ol);
  font-weight: 700; font-size: 15px; letter-spacing: 1px;
}
.pill.pressed, .pill:active { box-shadow: 0 1px 0 var(--ol); }
.pill .aicon { width: 26px; height: 26px; }
.pill .aicon svg { width: 100%; height: 100%; }

/* ---------- speech / thought bubble ---------- */
.bubble {
  position: absolute; left: 0; top: 0; pointer-events: none;
  min-width: 46px; height: 42px; padding: 0 12px;
  display: flex; align-items: center; justify-content: center; gap: 4px;
  background: #fff; border: 3px solid var(--ol); border-radius: 21px;
  font-weight: 700; font-size: 17px; white-space: nowrap;
  opacity: 0; transform: translate(-50%, -100%) scale(.4);
  transition: opacity .18s ease, transform .25s cubic-bezier(.3, 1.6, .5, 1);
}
.bubble.show { opacity: 1; transform: translate(-50%, -100%) scale(1); }
.bubble::before, .bubble::after {
  content: ''; position: absolute; background: #fff; border: 3px solid var(--ol); border-radius: 50%;
}
.bubble::before { width: 12px; height: 12px; left: 16px; bottom: -13px; }
.bubble::after { width: 7px; height: 7px; left: 8px; bottom: -22px; }
.bubble svg { width: 28px; height: 28px; }

#toast {
  position: absolute; z-index: 60; left: 50%; bottom: 146px; transform: translate(-50%, 10px);
  padding: 8px 16px; border-radius: 16px; background: var(--ol); color: #FFF6E9;
  font-weight: 600; font-size: 14px; white-space: nowrap; opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- modals ---------- */
.modal {
  position: absolute; inset: 0; background: rgba(60, 34, 18, .45);
  display: flex; align-items: center; justify-content: center; padding: 10px;
  transition: opacity .2s ease;
}
.modal.hidden { opacity: 0; pointer-events: none; }
.modal.hidden .sheet { transform: scale(.9) translateY(12px); }
.sheet {
  width: 100%; max-height: 100%; overflow: auto;
  background: var(--cream); border: 3px solid var(--ol); border-radius: 24px; box-shadow: 0 6px 0 var(--ol);
  padding: 12px 14px 16px;
  transition: transform .25s cubic-bezier(.3, 1.5, .5, 1);
}
.sheet.small { max-width: 320px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.sheet h2 { margin: 0 0 0 4px; font-size: 24px; font-weight: 700; }
.sheet h3 { margin: 8px 2px 6px; font-size: 15px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; }
/* the selected item's name sits on the right; the section label itself stays left */
.sheet h3 span[id$="Name"] { float: right; text-transform: none; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.close { width: 40px; height: 40px; padding: 7px; }
.preview {
  height: 150px; border-radius: 18px; border: 3px solid var(--ol);
  background: linear-gradient(#BDE6F5, #E3F5EE); overflow: hidden; position: relative;
}
.preview::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 30px; background: #A8D68B; border-top: 3px solid var(--ol); z-index: 0; }
.preview svg { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; }
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tile {
  position: relative; height: 58px; border: 3px solid var(--ol); border-radius: 14px; background: #fff;
  box-shadow: 0 3px 0 var(--ol); padding: 2px 2px 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.tile svg { width: 56px; height: 36px; }
.tile .tname { font-size: 10px; font-weight: 600; line-height: 1.05; margin-top: 1px; text-align: center; padding: 0 1px; }
.tile.sel { background: #FFE79A; }
.tile.sel::after {
  content: '✓'; position: absolute; top: -8px; right: -6px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--play); border: 2.5px solid var(--ol); color: #fff; font-size: 12px; line-height: 15px; text-align: center; font-weight: 700;
}
.tile.pressed, .tile:active { box-shadow: 0 0 0 var(--ol); }

.primary, .danger {
  display: block; width: 100%; height: 48px; margin-top: 12px;
  border: 3px solid var(--ol); border-radius: 16px; box-shadow: 0 4px 0 var(--ol);
  background: var(--play); color: #fff; font-weight: 700; font-size: 19px; letter-spacing: 1px;
  -webkit-text-stroke: 0; text-shadow: 0 2px 0 rgba(90, 54, 32, .45);
}
.primary.pressed, .primary:active, .danger.pressed, .danger:active { box-shadow: 0 1px 0 var(--ol); }
.primary.slim { width: 92px; margin: 0; flex: none; height: 46px; font-size: 16px; }
.primary.big { height: 56px; font-size: 24px; }
.danger { background: #F08A7E; margin-top: 18px; font-size: 16px; }
.danger.confirm { background: var(--warn); }

.field-label { display: block; font-weight: 600; font-size: 15px; margin: 10px 2px 6px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.between { justify-content: space-between; margin-top: 12px; }
.row.between .field-label { margin: 0; }
input[type=text], input[type=email], input[type=password] {
  flex: 1; min-width: 0; width: 100%; height: 46px; padding: 0 14px;
  border: 3px solid var(--ol); border-radius: 14px; background: #fff;
  font-family: inherit; font-size: 19px; font-weight: 600; color: var(--ink); outline: none;
  user-select: text; -webkit-user-select: text;
}
input[type=text]:focus, input[type=email]:focus, input[type=password]:focus { background: #FFFDF6; box-shadow: 0 0 0 3px #FFD35A; }
input::placeholder { color: #CDB59A; }
.toggle {
  position: relative; width: 62px; height: 34px; border-radius: 17px; border: 3px solid var(--ol);
  background: #E3D3BE; padding: 0;
}
.toggle .knob {
  position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; border: 2.5px solid var(--ol); transition: left .18s ease;
}
.toggle[aria-pressed=true] { background: var(--play); }
.toggle[aria-pressed=true] .knob { left: 30px; }
.fine { margin: 12px 0 0; font-size: 12.5px; color: var(--muted); text-align: center; }

/* ---------- title screen ---------- */
.screen {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #FBE8C8;
  background-image: radial-gradient(#F5D9AE 3px, transparent 3.5px);
  background-size: 26px 26px;
  transition: opacity .45s ease, transform .45s ease;
  padding: 16px;
}
.screen.hidden { opacity: 0; pointer-events: none; transform: scale(1.04); }
.logo {
  margin: 0; text-align: center; line-height: .95; font-weight: 700;
  font-size: 64px; color: #F39C4A; letter-spacing: 1px;
  -webkit-text-stroke: 9px var(--ol); paint-order: stroke fill;
  text-shadow: 0 5px 0 var(--ol);
}
.logo span { display: block; font-size: 32px; color: #FFF6E9; }
.title-bear { width: 234px; height: 234px; margin: 30px 0 4px; position: relative; }
/* smaller logo on the title screen so the hopping bear never runs into it */
#title .logo { font-size: 50px; -webkit-text-stroke-width: 8px; text-shadow: 0 4px 0 var(--ol); }
#title .logo span { font-size: 26px; }
.title-bear::before {
  content: ''; position: absolute; left: 30px; right: 30px; bottom: 16px; height: 28px; border-radius: 50%;
  background: #BFE3A0; border: 3px solid #94C77A;
}
.title-bear svg { position: relative; width: 100%; height: 100%; overflow: visible; }
.name-card {
  width: 100%; max-width: 320px; padding: 14px 16px 16px;
  background: var(--cream); border: 3px solid var(--ol); border-radius: 22px; box-shadow: 0 5px 0 var(--ol);
  text-align: center;
}
.name-card label { display: block; font-weight: 600; font-size: 17px; margin-bottom: 10px; }
.name-card input { text-align: center; }
.card-label { display: block; font-weight: 600; font-size: 17px; margin-bottom: 10px; }
.gender-pick { display: flex; gap: 10px; margin-bottom: 14px; }
.gender {
  flex: 1; height: 44px; border: 3px solid var(--ol); border-radius: 14px; box-shadow: 0 3px 0 var(--ol);
  background: #fff; font-weight: 700; font-size: 17px; letter-spacing: 1px;
}
.gender[aria-pressed=true] { background: #7EC8E3; color: #fff; text-shadow: 0 2px 0 rgba(90, 54, 32, .45); }
.gender.girl[aria-pressed=true] { background: #F28DB2; }
.gender.pressed, .gender:active { box-shadow: 0 1px 0 var(--ol); }
.name-card .primary { margin-top: 12px; }

#scene .hit { cursor: pointer; }

/* ---------- login screen ---------- */
#login .logo { margin-bottom: 22px; }
.login-card input + input { margin-top: 10px; }
#loginInvite { text-transform: uppercase; letter-spacing: 1px; }
.login-card input { font-size: 17px; }
.login-msg { min-height: 18px; margin: 8px 2px 0; font-size: 13.5px; font-weight: 600; color: #C8553D; }
.primary:disabled, .ghost:disabled { opacity: .6; }
.ghost {
  height: 40px; padding: 0 14px; border: 3px solid var(--ol); border-radius: 14px; box-shadow: 0 3px 0 var(--ol);
  background: #fff; color: var(--ink); font-weight: 700; font-size: 14px; letter-spacing: .5px;
}
.ghost.pressed, .ghost:active { box-shadow: 0 1px 0 var(--ol); }
.ghost.wide { display: block; width: 100%; margin-top: 12px; }
.account-email { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
[hidden] { display: none !important; }

/* ---------- boot splash ---------- */
#boot { position: fixed; z-index: 50; gap: 26px; }
.boot-dots { display: flex; gap: 10px; }
.boot-dots i {
  width: 14px; height: 14px; border-radius: 50%; background: #F39C4A; border: 3px solid var(--ol);
  animation: bootDot 1s ease-in-out infinite;
}
.boot-dots i:nth-child(2) { animation-delay: .15s; }
.boot-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes bootDot { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-10px); } }
/* fade the splash only after the screen underneath has faded in */
#boot.hidden { transition-delay: .4s; }

/* ---------- coins ---------- */
.coinplate {
  position: absolute; left: 0; top: 0; height: 44px; min-width: 64px; padding: 0 12px 0 6px;
  display: flex; align-items: center; gap: 5px;
  background: var(--cream); border: 3px solid var(--ol); border-radius: 22px; box-shadow: 0 4px 0 var(--ol);
  font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums;
}
.coinplate .cicon { width: 28px; height: 28px; flex: none; }
.coinplate .cicon svg { width: 100%; height: 100%; }
.coinplate.inline { position: static; height: 34px; min-width: 0; font-size: 16px; box-shadow: 0 3px 0 var(--ol); padding: 0 10px 0 4px; }
.coinplate.inline .cicon { width: 24px; height: 24px; }
.coinplate.bump { animation: coinBump .35s ease; }
@keyframes coinBump { 50% { transform: scale(1.14); } }
.sheet-head .coinplate { margin-left: auto; margin-right: 10px; }

.pills { display: flex; justify-content: center; gap: 10px; }
.pills .pill { margin: 8px 0 0; height: 36px; }
.pill.mini { background: #D9F0FB; }

/* wardrobe: locked items show their price */
.tile .price {
  position: absolute; top: -9px; left: -7px; height: 21px; padding: 0 6px 0 2px;
  display: flex; align-items: center; gap: 2px;
  background: var(--cream); border: 2.5px solid var(--ol); border-radius: 11px;
  font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.tile .price svg { width: 15px; height: 15px; }
.tile.locked > svg { opacity: .45; filter: grayscale(.4); }
.tile.locked .tname { color: var(--muted); }
.tile.arm { background: #FFE79A; }
.tile.arm .tname { color: var(--ink); }
.tile.cant { animation: shake .35s ease; }
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }

/* ---------- math mini game ---------- */
#hud, #panel { transition: opacity .25s ease, transform .25s ease; }
.minigame #hud { opacity: 0; pointer-events: none; transform: translateY(-12px); }
.minigame #panel { opacity: 0; pointer-events: none; transform: translateY(16px); }
#mini { position: absolute; inset: 0; pointer-events: none; }
#mini.hidden { display: none; }
#mini > * { pointer-events: auto; }
.mini-top {
  position: absolute; left: 10px; right: 10px; top: 10px; padding: 10px 12px 12px;
  background: rgba(255, 246, 233, .96); border: 3px solid var(--ol); border-radius: 20px; box-shadow: 0 4px 0 var(--ol);
}
.mini-bar { height: 16px; border: 2.5px solid var(--ol); border-radius: 9px; background: #EFDCC2; overflow: hidden; }
.mini-fill { height: 100%; width: 100%; background: var(--play); transform-origin: 0 50%; box-shadow: inset 0 3px 0 rgba(255, 255, 255, .38); }
.mini-top.low .mini-fill { background: var(--warn); }
.mini-stats { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; font-weight: 700; }
.mini-time { font-size: 17px; font-variant-numeric: tabular-nums; min-width: 54px; }
.mini-top.low .mini-time { color: var(--warn); }
.mini-streak { font-size: 14px; color: #E0803A; }
.mini-q { margin-top: 8px; text-align: center; }
.mini-text { font-size: 40px; font-weight: 700; line-height: 1.15; min-height: 58px; display: flex; align-items: center; justify-content: center; gap: 2px; }
.mini-text.pop { animation: qpop .25s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes qpop { from { transform: scale(.7); opacity: 0; } }
.mini-text sup { font-size: .55em; }
.radwrap { display: inline-flex; align-items: stretch; }
.radwrap .radsign { width: .5em; height: auto; flex: none; margin-right: -1px; }
.radwrap .rad { border-top: 3.5px solid currentColor; padding: 2px 3px 0 2px; line-height: 1.05; }
.radwrap.small .rad { border-top-width: 2px; padding-top: 1px; }
.radwrap.small .radsign path { stroke-width: 2px; }
.mini-text .lims { display: inline-flex; flex-direction: column; font-size: .42em; line-height: 1.05; margin: 0 4px 0 -2px; text-align: left; }
.mini-text .int { font-size: 1.15em; font-weight: 600; }
.mini-joke { min-height: 18px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.mini-answers {
  position: absolute; left: 0; right: 0; bottom: 0; height: 132px; padding: 14px 10px 0;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  background: var(--cream); border-top: 3px solid var(--ol); border-radius: 22px 22px 0 0;
}
.ans {
  height: 84px; border: 3px solid var(--ol); border-radius: 18px; box-shadow: 0 4px 0 var(--ol);
  font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.ans[data-i="0"] { background: #FFD9B0; }
.ans[data-i="1"] { background: #CDEBFA; }
.ans[data-i="2"] { background: #E0D9FA; }
.ans.pressed, .ans:active { box-shadow: 0 1px 0 var(--ol); }
.ans.right { background: var(--play); color: #fff; text-shadow: 0 2px 0 rgba(90, 54, 32, .45); }
.ans.wrong { background: var(--warn); color: #fff; animation: shake .35s ease; }
/* answers lock briefly for feedback: keep their colours instead of the generic disabled look */
.ans:disabled { cursor: default; filter: none; opacity: 1; }
.mini-card {
  position: absolute; left: 16px; right: 16px; top: 50%; transform: translateY(-50%);
  max-width: 340px; margin: 0 auto; padding: 16px 16px 18px;
  background: var(--cream); border: 3px solid var(--ol); border-radius: 24px; box-shadow: 0 6px 0 var(--ol);
  text-align: center;
}
.mini-card.hidden { display: none; }
.mini-card h2 { margin: 2px 0 6px; font-size: 28px; }
.mini-lead { margin: 0 0 10px; font-size: 15px; }
.rewards { list-style: none; margin: 0; padding: 0; text-align: left; font-size: 14.5px; }
.rewards li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 4px; border-bottom: 2px dashed #EAD6BC; }
.rewards li b { color: #E0803A; white-space: nowrap; }
.rewards li.bad b { color: var(--warn); }
.mini-best { margin: 10px 0 0; font-size: 13.5px; font-weight: 600; color: var(--muted); min-height: 16px; }
.result-coins { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 46px; font-weight: 700; margin: 4px 0 6px; }
.result-coins .cicon { width: 50px; height: 50px; }
.result-coins .cicon svg { width: 100%; height: 100%; }
#mini.carded .mini-top, #mini.carded .mini-answers { display: none; }

/* hidden screens/modals must not keep catching taps through a rig's always-on hit area */
.hidden .hit { pointer-events: none !important; }
#login.hidden { transition-delay: .4s; }

/* ---------- iPhone: safe areas + install hint ---------- */
#safeProbe {
  position: fixed; left: 0; top: 0; width: 0; height: 0; visibility: hidden; pointer-events: none;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
}
/* the strip under the home indicator continues the cream bottom panel */
body::after {
  content: ''; position: fixed; left: 0; right: 0; bottom: 0; height: env(safe-area-inset-bottom, 0px);
  background: var(--cream); pointer-events: none;
}
.ios-hint {
  position: absolute; left: 12px; right: 12px; bottom: 148px; z-index: 40;
  display: flex; align-items: center; gap: 10px; padding: 9px 9px 9px 10px;
  background: var(--cream); border: 3px solid var(--ol); border-radius: 18px; box-shadow: 0 4px 0 var(--ol);
  animation: hintIn .35s cubic-bezier(.3, 1.5, .5, 1);
}
.ios-hint.low { bottom: 16px; }
.ios-hint p { flex: 1; margin: 0; font-size: 13.5px; line-height: 1.35; }
.ih-app { width: 42px; height: 42px; border-radius: 10px; border: 2.5px solid var(--ol); flex: none; }
.ih-share { display: inline-block; width: 19px; height: 19px; vertical-align: -4px; }
.ih-share svg { width: 100%; height: 100%; }
.ih-close { width: 34px; height: 34px; padding: 6px; flex: none; box-shadow: 0 3px 0 var(--ol); }
@keyframes hintIn { from { transform: translateY(16px); opacity: 0; } }

/* ---------- daily bonus ---------- */
.daily-sheet { text-align: center; }
.daily-sheet h2 { margin: 4px 0 2px; font-size: 26px; }
.daily-sub { margin: 0 0 10px; font-weight: 600; color: #E0803A; }
.daily-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.day {
  border: 2.5px solid var(--ol); border-radius: 10px; background: #fff; padding: 3px 0 4px;
  font-size: 10.5px; font-weight: 700; line-height: 1.2;
}
.day b { display: block; font-size: 14px; }
.day.done { background: #E3F3DC; color: var(--muted); }
.day.today { background: #FFE79A; transform: scale(1.08); box-shadow: 0 3px 0 var(--ol); }
#saveNote.sync-ok { color: #5E9B52; }
#saveNote.sync-warn { color: #D0694A; }
@media (prefers-reduced-motion: reduce) { .ff { animation: none; } }

/* ---------- vouchers ---------- */
#voucherInput { text-transform: uppercase; letter-spacing: 1px; font-size: 16px; }
.voucher-msg { min-height: 17px; margin: 6px 2px 0; font-size: 13px; font-weight: 600; color: var(--muted); }
.voucher-msg.ok { color: #5E9B52; }
.voucher-msg.bad { color: #D0694A; }
.login-msg.info { color: var(--muted); }

/* ---------- mini game levels ---------- */
.levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 2px 0 10px; }
.lvl {
  height: 54px; border: 3px solid var(--ol); border-radius: 14px; box-shadow: 0 3px 0 var(--ol); background: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.15;
}
.lvl b { font-size: 15px; letter-spacing: .5px; }
.lvl span { font-size: 12px; font-weight: 600; color: var(--muted); }
.lvl.pressed, .lvl:active { box-shadow: 0 1px 0 var(--ol); }
.lvl[data-l=easy][aria-pressed=true] { background: #D5F0CB; }
.lvl[data-l=normal][aria-pressed=true] { background: #CDEBFA; }
.lvl[data-l=hard][aria-pressed=true] { background: #E0D9FA; }
.lvl[aria-pressed=true] span { color: var(--ink); }
.rewards li.soft b { color: #5E9B52; }

/* ---------- tappable bees ---------- */
.beeHit { pointer-events: all; cursor: pointer; }
.tod-night #bees, .night #bees { pointer-events: none; }
.tod-night .beeHit, .night .beeHit { pointer-events: none; }
.bee.zip { animation: beeZip 1.2s ease-in-out; }
@keyframes beeZip {
  0% { transform: translate(0, 0) rotate(0) scale(1); }
  20% { transform: translate(24px, -16px) rotate(90deg) scale(1.25); }
  40% { transform: translate(6px, -40px) rotate(200deg) scale(1.3); }
  60% { transform: translate(-22px, -20px) rotate(290deg) scale(1.25); }
  80% { transform: translate(-8px, 6px) rotate(350deg) scale(1.1); }
  100% { transform: translate(0, 0) rotate(360deg) scale(1); }
}

/* ---------- wardrobe tabs ---------- */
.wtabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px 0 2px; }
.wtab {
  height: 36px; border: 3px solid var(--ol); border-radius: 12px; box-shadow: 0 3px 0 var(--ol); background: #fff;
  font-weight: 700; font-size: 12.5px; letter-spacing: .4px; padding: 0;
}
.wtab[aria-selected=true] { background: #FFE79A; }
.wtab.pressed, .wtab:active { box-shadow: 0 1px 0 var(--ol); }
/* tall enough for the longest tab (4 rows), so the sheet does not jump when switching */
.wpanels { min-height: 285px; }
.short .preview { height: 112px; }
.short .tile { height: 52px; }
.short .tile svg { height: 32px; }
.short .wpanels { min-height: 258px; }
.short #wardrobe .done { margin-top: 8px; }

/* ---------- language picker ---------- */
.langpick { display: flex; border: 3px solid var(--ol); border-radius: 12px; overflow: hidden; box-shadow: 0 3px 0 var(--ol); }
.langpick button { width: 44px; height: 30px; border: 0; background: #fff; font-weight: 700; font-size: 13px; padding: 0; }
.langpick button + button { border-left: 3px solid var(--ol); }
.langpick button[aria-pressed=true] { background: #FFE79A; }
.langpick.float { position: absolute; top: 14px; right: 14px; }

/* ---------- wardrobe: try-on + buy ---------- */
.tile.try { background: #DDF1FB; box-shadow: 0 0 0 3px #4DB6E8, 0 3px 0 var(--ol); }
.tile.try > svg { opacity: 1; filter: none; }
.buy {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; height: 46px; margin-top: 12px;
  border: 3px solid var(--ol); border-radius: 16px; box-shadow: 0 4px 0 var(--ol);
  background: #4DB6E8; color: #fff; font-weight: 700; font-size: 19px; letter-spacing: 1px;
  text-shadow: 0 2px 0 rgba(90, 54, 32, .45);
}
.buy .bprice { display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px 1px 3px; border-radius: 12px; background: rgba(255, 255, 255, .25); }
.buy .bprice svg { width: 22px; height: 22px; }
.buy.pressed, .buy:active { box-shadow: 0 1px 0 var(--ol); }
/* not enough coins: grey, but still tappable so it can say why */
.buy.cant, .buy.idle { background: #C9BFB2; color: #F4EEE6; text-shadow: none; }
.buy.idle { cursor: default; }
.buy.idle.pressed, .buy.idle:active { transform: none; box-shadow: 0 4px 0 var(--ol); }
.buy.cant .bprice svg { filter: grayscale(1); opacity: .7; }
.buy.shake { animation: shake .35s ease; }
.buy + .done { margin-top: 10px; }
.short .buy { height: 42px; margin-top: 8px; }
/* while a sheet is open the bottom of the screen holds its buttons, so messages go to the top */
#game:has(.modal:not(.hidden)) #toast { bottom: auto; top: 14px; }

/* dark frames (round glasses, sunglasses) would disappear on a dark face: draw them light there */
.glassesSlot.onDark [stroke="#3A2A22"], .glassesSlot.onDark [stroke="#1C171F"] { stroke: #F2E4CC; }

/* ---------- beehive: swings from where it hangs on the branch ---------- */
.hive { cursor: pointer; transform-box: view-box; transform-origin: 284px 238px; }
.hive.wobble { animation: hiveWobble .95s ease-out; }
.hive.shake { animation: hiveShake 1.5s ease-out; }
@keyframes hiveWobble { 15% { transform: rotate(7deg); } 35% { transform: rotate(-5deg); } 55% { transform: rotate(3deg); } 75% { transform: rotate(-1.5deg); } }
@keyframes hiveShake {
  6% { transform: rotate(17deg); } 14% { transform: rotate(-16deg); } 22% { transform: rotate(15deg); } 30% { transform: rotate(-14deg); }
  38% { transform: rotate(12deg); } 48% { transform: rotate(-9deg); } 60% { transform: rotate(6deg); } 74% { transform: rotate(-3deg); }
}
/* angry bees: fast, wide, jittery loops and an orange-red body */
.bee.angry { animation: beeAngry .42s linear infinite; }
.bee.angry ellipse[fill="#FFD35A"] { fill: #F2703A; }
@keyframes beeAngry {
  25% { transform: translate(24px, -16px) rotate(22deg) scale(1.15); }
  50% { transform: translate(-20px, -28px) rotate(-18deg) scale(1.15); }
  75% { transform: translate(-26px, 8px) rotate(26deg) scale(1.15); }
}
@media (prefers-reduced-motion: reduce) { .hive.wobble, .hive.shake, .bee.angry { animation: none; } }

/* ---------- mini game picker + Match the Cards ---------- */
.games { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 0 0 8px; }
.gm { height: 36px; border: 3px solid var(--ol); border-radius: 12px; box-shadow: 0 3px 0 var(--ol); background: #fff; font-weight: 700; font-size: 12.5px; padding: 0 2px; line-height: 1.05; }
.gm[aria-pressed=true] { background: #FFE79A; }
.gm.pressed, .gm:active { box-shadow: 0 1px 0 var(--ol); }
.mini-cards { display: none; position: absolute; left: 12px; right: 12px; gap: 8px; pointer-events: auto; }
#mini.cardsMode .mini-cards { display: grid; }
#mini.cardsMode .mini-answers, #mini.carded .mini-cards { display: none; }
.mcard { position: relative; padding: 0; border: 0; background: none; perspective: 600px; }
.mcard .face {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  border: 3px solid var(--ol); border-radius: 14px; box-shadow: 0 3px 0 var(--ol);
  backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: transform .3s ease;
}
.mcard .back { background: #FFE9B0; }
.mcard .back svg { width: 58%; height: 58%; }
.mcard .front { background: #fff; transform: rotateY(180deg); }
.mcard .front svg { width: 86%; height: 78%; }
.mcard.up .back { transform: rotateY(180deg); }
.mcard.up .front { transform: rotateY(0); }
.mcard.got .front { background: #E3F3DC; animation: qpop .3s ease; }
.cardsMode .mini-text { font-size: 26px; min-height: 0; }

/* ---------- apple tree: the leaves sway from where they sit on the trunk ---------- */
.canopy { cursor: pointer; transform-box: view-box; transform-origin: 36px 228px; }
.canopy.sway { animation: treeSway .9s ease-out; }
.canopy.shake { animation: treeShake 1.3s ease-out; }
@keyframes treeSway { 20% { transform: rotate(3deg); } 45% { transform: rotate(-2.2deg); } 70% { transform: rotate(1.2deg); } }
@keyframes treeShake {
  7% { transform: rotate(6deg); } 16% { transform: rotate(-6deg); } 25% { transform: rotate(5.5deg); } 34% { transform: rotate(-5deg); }
  44% { transform: rotate(4deg); } 56% { transform: rotate(-3deg); } 70% { transform: rotate(1.6deg); } 84% { transform: rotate(-.8deg); }
}
@media (prefers-reduced-motion: reduce) { .canopy.sway, .canopy.shake { animation: none; } }
