* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: #7fc27a;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  user-select: none; -webkit-user-select: none; touch-action: none;
}
#game, #ui { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#game { pointer-events: none; }
#vig {
  position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(20, 30, 60, .28) 100%);
}

#hud {
  position: fixed; top: 0; left: 0; right: 0; display: flex; gap: 8px; align-items: center;
  padding: calc(10px + env(safe-area-inset-top)) 12px 10px; pointer-events: none;
}
#hud > * { pointer-events: auto; }
.spacer { flex: 1; pointer-events: none !important; }
.pill {
  background: #fff; border-radius: 999px; padding: 6px 16px 6px 6px; font-weight: 800; font-size: 20px;
  color: #2b2b3a; display: flex; align-items: center; gap: 8px; box-shadow: 0 4px 0 rgba(0,0,0,.2), 0 8px 18px rgba(0,0,0,.18);
  background: linear-gradient(#fff, #f1f1f6);
}
.pill.small { font-size: 14px; padding: 9px 14px; }
.pill.bump { animation: bump .18s; }
@keyframes bump { 50% { transform: scale(1.12); } }
.coin {
  width: 30px; height: 30px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #7be08a, #2c9b3f); color: #fff;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.2);
  display: grid; place-items: center; font-size: 18px;
}
.btn {
  border: 0; background: #fff; border-radius: 12px; width: 40px; height: 40px; font-size: 18px;
  cursor: pointer; box-shadow: 0 3px 0 rgba(0,0,0,.18); color: #2b2b3a;
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,.18); }

#hint {
  position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: rgba(30,30,45,.82); color: #fff; padding: 9px 16px; border-radius: 999px; font-weight: 700;
  font-size: 15px; pointer-events: none; white-space: nowrap; max-width: 94vw; overflow: hidden;
  text-overflow: ellipsis; transition: opacity .2s;
}
#hint:empty { opacity: 0; }
#toast {
  position: fixed; left: 50%; top: 72px; transform: translate(-50%, -20px); opacity: 0;
  background: #ffcf3f; color: #3a2a00; padding: 10px 20px; border-radius: 14px; font-weight: 800;
  box-shadow: 0 4px 0 rgba(0,0,0,.2); pointer-events: none; transition: all .25s; text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

#panel {
  position: fixed; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.25);
  padding: 16px;
}
#panel[hidden] { display: none; }
.card {
  background: #fff7e8; border-radius: 20px; width: min(420px, 100%); padding: 14px;
  box-shadow: 0 8px 0 rgba(0,0,0,.2); max-height: 90vh; overflow: auto;
}
.head { display: flex; justify-content: space-between; align-items: center; font-size: 20px; margin-bottom: 8px; color: #2b2b3a; }
.group { font-size: 12px; font-weight: 800; color: #a0875e; text-transform: uppercase; margin: 10px 4px 4px; }
.row {
  display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 14px;
  padding: 8px 10px; margin-bottom: 6px;
}
.row .ico { font-size: 24px; width: 32px; text-align: center; }
.row .info { flex: 1; min-width: 0; }
.row .name { font-weight: 800; color: #2b2b3a; font-size: 15px; }
.pips { display: flex; gap: 3px; margin-top: 4px; }
.pips i { width: 14px; height: 6px; border-radius: 3px; background: #e7dcc6; }
.pips i.on { background: #ff8a3d; }
.buy {
  border: 0; border-radius: 12px; background: #39b54a; color: #fff; font-weight: 800; font-size: 15px;
  padding: 10px 12px; min-width: 84px; cursor: pointer; box-shadow: 0 3px 0 #23803280;
}
.buy:disabled { background: #c9c9c9; box-shadow: none; cursor: default; }

#stamPill { gap: 6px; padding: 7px 12px 7px 9px; }
#stamBar { display: block; width: 92px; height: 12px; border-radius: 6px; background: #e3e3ea; overflow: hidden; }
#stamFill { display: block; height: 100%; width: 100%; border-radius: 6px; background: linear-gradient(90deg, #39b54a, #9be36a); transition: width .15s; }
#stamPill.low #stamFill { background: linear-gradient(90deg, #e5484d, #ff9f1c); }
#stamPill.low { animation: bump .5s infinite; }
#alarm {
  position: fixed; left: 50%; top: 118px; transform: translateX(-50%); background: #e5484d; color: #fff;
  padding: 8px 18px; border-radius: 12px; font-weight: 800; box-shadow: 0 4px 0 rgba(0,0,0,.25); pointer-events: none;
  animation: bump .6s infinite;
}
#alarm[hidden] { display: none; }

.modal { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.25); padding: 16px; }
.modal[hidden] { display: none; }
#qbtn { position: relative; }
#qdot { position: absolute; top: -3px; right: -3px; width: 13px; height: 13px; border-radius: 50%; background: #e5484d; border: 2px solid #fff; animation: bump .8s infinite; }
#qdot[hidden] { display: none; }
.qbar { height: 8px; border-radius: 4px; background: #e7dcc6; overflow: hidden; margin-top: 5px; }
.qbar i { display: block; height: 100%; border-radius: 4px; background: #ff8a3d; }
.qnum { font-size: 12px; color: #8a7a5e; font-weight: 700; margin-top: 2px; }
.qstat { font-size: 12px; color: #8a7a5e; margin: 10px 4px 2px; line-height: 1.4; }
.wsum { color: #168a2e; font-size: 18px; white-space: nowrap; }
.buy.wide { width: 100%; margin-top: 6px; padding: 13px; font-size: 17px; }

#drop { position: fixed; right: calc(14px + env(safe-area-inset-right)); bottom: calc(70px + env(safe-area-inset-bottom)); width: 54px; height: 54px; font-size: 24px; border-radius: 16px; }
#drop[hidden] { display: none; }

#copw {
  position: fixed; left: 50%; top: 160px; transform: translateX(-50%); background: #3d5a80; color: #fff;
  padding: 8px 18px; border-radius: 12px; font-weight: 800; box-shadow: 0 4px 0 rgba(0,0,0,.25); pointer-events: none;
  animation: bump .6s infinite; white-space: nowrap; max-width: 94vw; overflow: hidden; text-overflow: ellipsis; font-size: 14px;
}
#copw[hidden] { display: none; }
.row.done { background: #fff6d6; }
